<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/params.php'
);

return [
    'id' => 'app-frontend-ico',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'controllerNamespace' => 'frontend\controllers',
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-ico-frontend',
            'cookieValidationKey' => 'eKLYlWKOENcC6UwmnPJhJUraP3h8HzOf',
        ],
        'user' => [
            'identityClass' => 'common\models\IcoMember',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the frontend
            'name' => 'advanced-frontend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                'api/user/register' => 'ico-member/create',
                'api/user/sms' => 'ico-member/sms',
                'api/order/create' => 'ico-order/create',
                'api/order/list' => 'ico-order/list',
                'api/order/detail' => 'ico-order/detail',
                'api/project/list' => 'ico-project/list',
                'api/project/detail' => 'ico-project/detail',
                'api/order/address' => 'ico-order/add-address',
                'api/user/login' => 'ico-member/login',
                'api/user/detail' => 'ico-member/detail',
                'api/user/logout' => 'ico-member/logout',
                'api/user/set-google-key' => 'ico-member/set-google-key',
                'api/user/close-or-open-google' => 'ico-member/close-or-open-google',
                'api/ico/apply' => 'ico-apply/create',
                'api/image/captcha' => 'site/get-image',
            ],
        ],
    ],
    'params' => $params,
];
